<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>内部插入脚本</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<script  src="../js/jquery-3.3.1.min.js"></script>
	<style type="text/css">
		 	div,span{
			    width: 140px;
			    height: 140px;
			    margin: 20px;
			    background: #9999CC;
			    border: #000 1px solid;
				float:left;
			    font-size: 17px;
			    font-family:Roman;
			}
			
			div .mini{
			    width: 30px;
			    height: 30px;
			    background: #CC66FF;
			    border: #000 1px solid;
			    font-size: 12px;
			    font-family:Roman;
			}
			
			div.visible{
				display:none;
			}
	 </style>
	 <script type="text/javascript">
		 $(function () {
			 // <input type="button" value="将反恐放置到city的后面"  id="b1"/>
			 $("#b1").click(function () {
				 //append
				 //$("#city").append($("#fk"));
				 //appendTo
				 $("#fk").appendTo($("#city"));
			 });
			 // <input type="button" value="将反恐放置到city的最前面"  id="b2"/>
			 $("#b2").click(function () {
				 //prepend
				 //$("#city").prepend($("#fk"));
				 //prependTo
				 $("#fk").prependTo($("#city"));
			 });

			 // <input type="button" value="将反恐插入到天津后面"  id="b3"/>
			 $("#b3").click(function () {
				 //after
				 //$("#tj").after($("#fk"));

				 //insertAfter
				 $("#fk").insertAfter($("#tj"));

			 });

			 // <input type="button" value="将反恐插入到天津前面"  id="b4"/>
			 $("#b4").click(function () {
				 //before
				 //$("#tj").before($("#fk"));
				 //insertBefore
				 $("#fk").insertBefore($("#tj"));

			 });
		 });


		
	</script>
	 
	 
	</head>
	 
	<body>

		<input type="button" value="将反恐放置到city的后面"  id="b1"/>
		<input type="button" value="将反恐放置到city的最前面"  id="b2"/>
		<input type="button" value="将反恐插入到天津后面"  id="b3"/>
		<input type="button" value="将反恐插入到天津前面"  id="b4"/>
		 <ul id="city">
		 	 <li id="bj" name="beijing">北京</li>
			 <li id="tj" name="tianjin">天津</li>
			 <li id="cq" name="chongqing">重庆</li>
		 </ul>
		 
		 
		  <ul id="love">
		 	 <li id="fk" name="fankong">反恐</li>
			 <li id="xj" name="xingji">星际</li>
		 </ul>
		
		<div id="foo1">Hello1</div> 
       
	</body>
	
	
   
</html>



